package com.aliyun.messagemgt.repository;

import com.aliyun.messagemgt.converter.SmsQuotaRenewConverter;
import com.aliyun.messagemgt.dto.SmsQuotaRenew;
import com.aliyun.messagemgt.domain.repository.SmsQuotaRenewRepository;
import com.aliyun.messagemgt.entities.SmsQuotaRenewEntity;
import com.aliyun.messagemgt.repository.mappers.SmsQuotaRenewMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description
 * @Author hzw
 * @Date 2020/12/15 15:21
 * @Version 1.0
 */
@Service
public class SmsQuotaRenewMybatisRepository implements SmsQuotaRenewRepository {
    @Autowired
    private SmsQuotaRenewMapper smsQuotaRenewMapper;

    /**
     * 插入续订信息
     *
     * @param smsQuotaRenew 短信配额监控信息
     */
    @Override
    public void insert(SmsQuotaRenew smsQuotaRenew) {
        smsQuotaRenewMapper.insert(smsQuotaRenew);
    }

    /**
     * 更新续订信息
     *
     * @param smsQuotaRenew 短信配额监控信息
     */
    @Override
    public void update(SmsQuotaRenew smsQuotaRenew) {
        smsQuotaRenewMapper.update(smsQuotaRenew);
    }

    /**
     * 查询续订列表
     *
     * @param smsQuotaRenew 查询类
     * @return list
     */
    @Override
    public List<SmsQuotaRenew> queryRenewListByEntity(SmsQuotaRenew smsQuotaRenew) {
        List<SmsQuotaRenewEntity> smsQuotaRenewEntityList = smsQuotaRenewMapper.queryRenewListByEntity(smsQuotaRenew);
        List<SmsQuotaRenew> smsQuotaRenewList = SmsQuotaRenewConverter.INSTANCE.smsQuotaRenewEntityList2smsQuotaRenewList(smsQuotaRenewEntityList);
        return smsQuotaRenewList;
    }

    @Override
    public void insertList(List<SmsQuotaRenew> renewList) {
        smsQuotaRenewMapper.insertList(renewList);
    }
}
